/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import request from '@/utils/request';
// 获取用户列表
// 获取当前用户信息
export async function queryCurrent() {
  return request('/Api/currentUser');
}

// 登入
export async function accountLogin(params) {
  return request('/Api/Auth/login', {
    method: 'POST',
    body: params,
  });
}

// 登出
export async function accountLogout(params) {
  return request('/Api/Handle/run', {
    method: 'POST',
    body: {
      data: JSON.stringify(params),
    },
  });
}

// 注册
export async function accountRegister(params) {
  return request('/Api/Auth/register', {
    method: 'POST',
    body: params,
  });
}

// 修改
export async function accountModify(params) {
  return request('/Api/Auth/resetPwd', {
    method: 'POST',
    body: params,
  });
}

// 获取验证码
export async function getCaptcha(params) {
  const { token, site_key, ...rest } = params;
  return request('/Api/Verify/sendSms', {
    method: 'POST',
    body: rest,
    headers: {
      Token: token,
      'Site-key': site_key,
    },
  });
}

// 公司信息
export async function setCompanyInfo(params) {
  return request('/Api/Company/companyRegister', {
    method: 'POST',
    body: params,
  });
}

export async function getCompanyInfo(params) {
  return request('/Api/Company/info', {
    method: 'POST',
    body: params,
  });
}

// 信息品牌列表
export async function getBrandInfo(params) {
  return request('/Api/Handle/run', {
    method: 'POST',
    body: {
      run: '/Company/brandList',
      time: new Date().getTime(),
      data: JSON.stringify({
        data: params,
      }),
    },
  });
}

// 获取用户信息
export async function getUserInfo(params) {
  return request('/Api/Handle/run', {
    method: 'POST',
    body: {
      data: JSON.stringify(params),
    },
  });
}

// 登录前获取加密密钥
export async function loginEncryption(params) {
  return request('/Api/Auth/verify', {
    method: 'POST',
    body: params,
  });
}
